import request from '@/utils/request'

// 获取字段映射关系
export function getOption(params) {
  return request({
    url: `/v1/base/get-option`,
    method: 'get',
    params
  })
}

// 获取操作日志
export function log(params) {
  return request({
    url: `/v1/base/log`,
    method: 'get',
    params
  })
}

// 获取字段映射关系
export function getAllenum(params) {
  return request({
    url: `/wms_v1_pc/base/all-enum-name`,
    method: 'get',
    params
  })
}

// 获取下拉框枚举值
export function getEnums(data) {
  return request({
    url: `/wms_v1_pc/base/get-enums`,
    method: 'POST',
    data
  })
}

// 获取仓库数据
export function getWareData(params) {
  return request({
    baseURL: window.APP_GETEWAY.wms,
    url: `/api/warehouse-option`,
    method: 'get',
    params
  })
}

// 获取基础sku信息
export function getBaseSku(params) {
  return request({
    url: `/wms_v1_pc/base/get-base-sku`,
    method: 'get',
    params
  })
}

// 获取国家
export function queryCountry(params) {
  return request({
    url: '/base/country/get-list',
    method: 'get',
    params
  })
}

// 获取sku可用库存货位信息
export function getSKULocation(data) {
  return request({
    url: '/wms_v1_pc/base/get-sku-num',
    method: 'POST',
    data
  })
}

// 员工
export function getTenantOrganization(params) {
  return request({
    baseURL: window.APP_GETEWAY.auth,
    url: '/tenant/organization',
    method: 'get',
    params
  })
}

/**
 * 获取物流商列表
 * @returns {any}
 */
export const getLogistics = () => {
  return request({
    baseURL: window.APP_GETEWAY.tms,
    url: '/logistics/logistics/index',
    method: "POST",
  })
}

/**
 * 根据物流商id获取渠道列表
 * @returns {any}
 */
export const getLogisticsChannel = (logistics_id) => {
  return request({
    baseURL: window.APP_GETEWAY.tms,
    url: '/channel/dm/get-logistics-channel',
    method: "POST",
    data: { logistics_id }
  })
}

/**
 * 获取国家
 * @returns {any}
 */
export const getCountry = () => {
  return request({
    baseURL: window.APP_GETEWAY.goods,
    url: '/api/goods/get-country-lable',
    method: "GET",
  })
}

// 上传并保存照片
export function uploadSaveImage(data) {
  return request({
    url: `/wms_v1_pc/base/upload-save-image`,
    method: 'POST',
    data
  })
}

// 获取保存的照片
export const getImage = (params) => {
  return request({
    url: '/wms_v1_pc/base/get-abnormal-image',
    method: "GET",
    params
  })
}

// 上传并保存照片
export function deleteImage(data) {
  return request({
    url: `/wms_v1_pc/base/delete-image`,
    method: 'POST',
    data
  })
}

// 获取所有货位
export function getLocationData(data) {
  return request({
    url: `/wms_v1_pc/base/get-location-data`,
    method: 'POST',
    data
  })
}

// 获取仓库、楼层
export function getWareDataFloor(params) {
  return request({
    url: `/wms_v1_pc/base/get-ware-data`,
    method: 'GET',
    params
  })
}

// 获取平台列表
export function getPlatforms(params) {
  return request({
    baseURL: window.APP_GETEWAY.base,
    url: `/v1/platform/platforms`,
    method: 'GET',
    params
  })
}

// 获取组合sku信息
export function getComboSKUInfo(data) {
  return request({
    url: `/wms_v1_pc/base/get-combo-sku-info`,
    method: 'POST',
    data
  })
}

// 店铺下拉列表
export function getShopList(data) {
  return request({
    baseURL: window.APP_GETEWAY.base,
    url: `/v1/shop/drop-list`,
    method: 'POST',
    data
  })
}

export function tmsOptions(data) {
  return request({
    baseURL: window.APP_GETEWAY.tms,
    url: `/options`,
    method: "post",
    data,
  });
}

// 导出中心详情
export function getExportConfig(id) {
  return request({
    baseURL: window.APP_GETEWAY.dexh,
    url: `/export_config/${id}`,
    method: "get",
  });
}

// 新增导出详情
export function exportRord(data) {
  return request({
    baseURL: window.APP_GETEWAY.dexh,
    url: `/export_record`,
    method: "post",
    data
  });
}

// 新增导出模版
export function exporttpl(data) {
  return request({
    baseURL: window.APP_GETEWAY.dexh,
    url: `/export_tpl`,
    method: "post",
    data
  });
}

// 字段模板
export function exportTemplateOne(params) {
  return request({
    baseURL: window.APP_GETEWAY.dexh,
    url: `/export_config/one`,
    method: "get",
    params
  });
}

// 删除模板
export function exportTemplateDelete(id) {
  return request({
    baseURL: window.APP_GETEWAY.dexh,
    url: `/export_tpl/${id}`,
    method: "delete"
  });
}

